home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1993 / Internet Info CD-ROM (Walnut Creek) (1993).iso / networking / cisco / cisco-expect.shar < prev    next >
SHell self-extracting ARchive  |  1992-08-07  |  6.4 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: SHell self-extracting ARchive (archive/shar).

You can browse this item here: cisco-expect.shar

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert SHell self-extracting ARchive (archive/shar) ext Supported
1% dexvert Text File (text/txt) fallback Supported
100% file Perl script text executable default
99% file POSIX shell script text executable default
98% file a /bin/sh script, ASCII text executable default (weak)
100% TrID Perl script default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% gt2 Shell Skript: '/bin/sh' default (weak)
100% detectItEasy Format: plain text[LF] default (weak)
100% binwalkID Executable script, shebang: "/bin/sh" default (weak)
100% xdgMime application/x-shellscript default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 23 21 20 2f 62 69 6e 2f | 73 68 0a 23 20 54 68 69 |#! /bin/|sh.# Thi|
|00000010| 73 20 69 73 20 61 20 73 | 68 65 6c 6c 20 61 72 63 |s is a s|hell arc|
|00000020| 68 69 76 65 2c 20 6d 65 | 61 6e 69 6e 67 3a 0a 23 |hive, me|aning:.#|
|00000030| 20 31 2e 20 52 65 6d 6f | 76 65 20 65 76 65 72 79 | 1. Remo|ve every|
|00000040| 74 68 69 6e 67 20 61 62 | 6f 76 65 20 74 68 65 20 |thing ab|ove the |
|00000050| 23 21 20 2f 62 69 6e 2f | 73 68 20 6c 69 6e 65 2e |#! /bin/|sh line.|
|00000060| 0a 23 20 32 2e 20 53 61 | 76 65 20 74 68 65 20 72 |.# 2. Sa|ve the r|
|00000070| 65 73 75 6c 74 69 6e 67 | 20 74 65 78 74 20 69 6e |esulting| text in|
|00000080| 20 61 20 66 69 6c 65 2e | 0a 23 20 33 2e 20 45 78 | a file.|.# 3. Ex|
|00000090| 65 63 75 74 65 20 74 68 | 65 20 66 69 6c 65 20 77 |ecute th|e file w|
|000000a0| 69 74 68 20 2f 62 69 6e | 2f 73 68 20 28 6e 6f 74 |ith /bin|/sh (not|
|000000b0| 20 63 73 68 29 20 74 6f | 20 63 72 65 61 74 65 20 | csh) to| create |
|000000c0| 74 68 65 20 66 69 6c 65 | 73 3a 0a 23 09 63 69 73 |the file|s:.#.cis|
|000000d0| 63 6f 63 68 65 63 6b 70 | 6f 69 6e 74 0a 23 09 63 |cocheckp|oint.#.c|
|000000e0| 69 73 63 6f 63 6f 6e 66 | 69 67 75 72 65 0a 23 09 |iscoconf|igure.#.|
|000000f0| 63 69 73 63 6f 67 65 74 | 0a 23 09 63 69 73 63 6f |ciscoget|.#.cisco|
|00000100| 67 65 74 2e 65 78 70 0a | 23 09 63 69 73 63 6f 6c |get.exp.|#.ciscol|
|00000110| 6f 67 69 6e 2e 65 78 70 | 65 63 74 0a 23 09 63 6c |ogin.exp|ect.#.cl|
|00000120| 65 61 6e 63 6f 6e 66 69 | 67 0a 23 20 54 68 69 73 |eanconfi|g.# This|
|00000130| 20 61 72 63 68 69 76 65 | 20 63 72 65 61 74 65 64 | archive| created|
|00000140| 3a 20 46 72 69 20 4d 61 | 79 20 20 33 20 31 30 3a |: Fri Ma|y 3 10:|
|00000150| 35 36 3a 35 32 20 31 39 | 39 31 0a 65 78 70 6f 72 |56:52 19|91.expor|
|00000160| 74 20 50 41 54 48 3b 20 | 50 41 54 48 3d 2f 62 69 |t PATH; |PATH=/bi|
|00000170| 6e 3a 24 50 41 54 48 0a | 69 66 20 74 65 73 74 20 |n:$PATH.|if test |
|00000180| 2d 66 20 27 63 69 73 63 | 6f 63 68 65 63 6b 70 6f |-f 'cisc|ocheckpo|
|00000190| 69 6e 74 27 0a 74 68 65 | 6e 0a 09 65 63 68 6f 20 |int'.the|n..echo |
|000001a0| 73 68 61 72 3a 20 77 69 | 6c 6c 20 6e 6f 74 20 6f |shar: wi|ll not o|
|000001b0| 76 65 72 2d 77 72 69 74 | 65 20 65 78 69 73 74 69 |ver-writ|e existi|
|000001c0| 6e 67 20 66 69 6c 65 20 | 22 27 63 69 73 63 6f 63 |ng file |"'ciscoc|
|000001d0| 68 65 63 6b 70 6f 69 6e | 74 27 22 0a 65 6c 73 65 |heckpoin|t'".else|
|000001e0| 0a 63 61 74 20 3c 3c 20 | 5c 53 48 41 52 5f 45 4f |.cat << |\SHAR_EO|
|000001f0| 46 20 3e 20 27 63 69 73 | 63 6f 63 68 65 63 6b 70 |F > 'cis|cocheckp|
|00000200| 6f 69 6e 74 27 0a 23 21 | 2f 75 73 72 2f 6c 6f 63 |oint'.#!|/usr/loc|
|00000210| 61 6c 2f 62 69 6e 2f 65 | 78 70 65 63 74 20 2d 66 |al/bin/e|xpect -f|
|00000220| 0a 23 0a 23 20 72 65 73 | 74 61 72 74 20 49 50 20 |.#.# res|tart IP |
|00000230| 61 63 63 6f 75 6e 74 69 | 6e 67 20 73 74 61 74 69 |accounti|ng stati|
|00000240| 73 74 69 63 73 0a 23 0a | 23 20 61 72 67 73 3a 20 |stics.#.|# args: |
|00000250| 63 69 73 63 6f 67 65 74 | 20 72 6f 75 74 65 72 20 |ciscoget| router |
|00000260| 70 61 73 73 77 64 20 65 | 6e 61 62 6c 65 70 61 73 |passwd e|nablepas|
|00000270| 73 77 64 0a 23 0a 0a 73 | 65 74 20 72 6f 75 74 65 |swd.#..s|et route|
|00000280| 72 20 5b 69 6e 64 65 78 | 20 24 61 72 67 76 20 31 |r [index| $argv 1|
|00000290| 5d 0a 73 65 74 20 70 61 | 73 73 77 6f 72 64 20 5b |].set pa|ssword [|
|000002a0| 69 6e 64 65 78 20 24 61 | 72 67 76 20 32 5d 0a 73 |index $a|rgv 2].s|
|000002b0| 65 74 20 65 6e 61 62 6c | 65 70 61 73 73 20 5b 69 |et enabl|epass [i|
|000002c0| 6e 64 65 78 20 24 61 72 | 67 76 20 33 5d 0a 0a 70 |ndex $ar|gv 3]..p|
|000002d0| 72 6f 63 20 74 69 6d 65 | 64 6f 75 74 20 7b 61 72 |roc time|dout {ar|
|000002e0| 67 73 7d 20 7b 0a 09 73 | 65 6e 64 5f 75 73 65 72 |gs} {..s|end_user|
|000002f0| 20 22 45 78 70 65 63 74 | 20 74 69 6d 65 64 20 6f | "Expect| timed o|
|00000300| 75 74 22 20 24 61 72 67 | 73 20 5c 6e 0a 09 65 78 |ut" $arg|s \n..ex|
|00000310| 69 74 0a 7d 0a 0a 73 6f | 75 72 63 65 20 63 69 73 |it.}..so|urce cis|
|00000320| 63 6f 6c 6f 67 69 6e 2e | 65 78 70 65 63 74 0a 0a |cologin.|expect..|
|00000330| 69 66 20 7b 5b 6c 65 6e | 67 74 68 20 24 61 72 67 |if {[len|gth $arg|
|00000340| 76 5d 20 3c 20 34 7d 20 | 7b 0a 09 70 72 69 6e 74 |v] < 4} |{..print|
|00000350| 20 22 49 6e 76 61 6c 69 | 64 20 6e 75 6d 62 65 72 | "Invali|d number|
|00000360| 20 6f 66 20 61 72 67 75 | 6d 65 6e 74 73 5c 6e 22 | of argu|ments\n"|
|00000370| 0a 09 65 78 69 74 0a 7d | 0a 0a 73 65 6e 64 5f 75 |..exit.}|..send_u|
|00000380| 73 65 72 20 5c 6e 5c 6e | 5c 6e 0a 73 70 61 77 6e |ser \n\n|\n.spawn|
|00000390| 20 74 65 6c 6e 65 74 20 | 24 72 6f 75 74 65 72 0a | telnet |$router.|
|000003a0| 6c 6f 67 69 6e 20 24 65 | 6e 61 62 6c 65 70 61 73 |login $e|nablepas|
|000003b0| 73 0a 73 65 6e 64 20 63 | 6c 65 61 72 20 69 70 20 |s.send c|lear ip |
|000003c0| 61 63 63 6f 75 6e 74 69 | 6e 67 5c 72 0a 65 78 70 |accounti|ng\r.exp|
|000003d0| 65 63 74 20 2a 23 2a 0a | 73 65 6e 64 20 51 55 49 |ect *#*.|send QUI|
|000003e0| 54 5c 72 0a 65 78 70 65 | 63 74 20 2a 43 6c 6f 73 |T\r.expe|ct *Clos|
|000003f0| 65 64 2a 0a 65 78 69 74 | 20 30 0a 53 48 41 52 5f |ed*.exit| 0.SHAR_|
|00000400| 45 4f 46 0a 63 68 6d 6f | 64 20 2b 78 20 27 63 69 |EOF.chmo|d +x 'ci|
|00000410| 73 63 6f 63 68 65 63 6b | 70 6f 69 6e 74 27 0a 66 |scocheck|point'.f|
|00000420| 69 20 23 20 65 6e 64 20 | 6f 66 20 6f 76 65 72 77 |i # end |of overw|
|00000430| 72 69 74 69 6e 67 20 63 | 68 65 63 6b 0a 69 66 20 |riting c|heck.if |
|00000440| 74 65 73 74 20 2d 66 20 | 27 63 69 73 63 6f 63 6f |test -f |'ciscoco|
|00000450| 6e 66 69 67 75 72 65 27 | 0a 74 68 65 6e 0a 09 65 |nfigure'|.then..e|
|00000460| 63 68 6f 20 73 68 61 72 | 3a 20 77 69 6c 6c 20 6e |cho shar|: will n|
|00000470| 6f 74 20 6f 76 65 72 2d | 77 72 69 74 65 20 65 78 |ot over-|write ex|
|00000480| 69 73 74 69 6e 67 20 66 | 69 6c 65 20 22 27 63 69 |isting f|ile "'ci|
|00000490| 73 63 6f 63 6f 6e 66 69 | 67 75 72 65 27 22 0a 65 |scoconfi|gure'".e|
|000004a0| 6c 73 65 0a 63 61 74 20 | 3c 3c 20 5c 53 48 41 52 |lse.cat |<< \SHAR|
|000004b0| 5f 45 4f 46 20 3e 20 27 | 63 69 73 63 6f 63 6f 6e |_EOF > '|ciscocon|
|000004c0| 66 69 67 75 72 65 27 0a | 23 21 2f 75 73 72 2f 6c |figure'.|#!/usr/l|
|000004d0| 6f 63 61 6c 2f 62 69 6e | 2f 65 78 70 65 63 74 20 |ocal/bin|/expect |
|000004e0| 2d 66 0a 23 0a 23 20 46 | 65 74 63 68 20 63 6f 6e |-f.#.# F|etch con|
|000004f0| 66 69 67 75 72 61 74 69 | 6f 6e 20 69 6e 66 6f 72 |figurati|on infor|
|00000500| 6d 61 74 69 6f 6e 20 66 | 72 6f 6d 20 74 68 65 20 |mation f|rom the |
|00000510| 73 70 65 63 69 66 69 65 | 64 20 63 69 73 63 6f 20 |specifie|d cisco |
|00000520| 72 6f 75 74 65 72 0a 23 | 0a 23 20 61 72 67 73 3a |router.#|.# args:|
|00000530| 20 63 69 73 63 6f 67 65 | 74 20 72 6f 75 74 65 72 | ciscoge|t router|
|00000540| 20 70 61 73 73 77 64 20 | 65 6e 61 62 6c 65 70 61 | passwd |enablepa|
|00000550| 73 73 77 64 20 66 69 6c | 65 6e 61 6d 65 0a 23 0a |sswd fil|ename.#.|
|00000560| 73 65 74 20 6c 6f 63 61 | 6c 68 6f 73 74 20 5b 65 |set loca|lhost [e|
|00000570| 78 65 63 20 68 6f 73 74 | 6e 61 6d 65 5d 0a 73 65 |xec host|name].se|
|00000580| 74 20 74 66 74 70 64 69 | 72 20 2f 70 72 69 76 61 |t tftpdi|r /priva|
|00000590| 74 65 2f 74 66 74 70 62 | 6f 6f 74 0a 0a 73 65 74 |te/tftpb|oot..set|
|000005a0| 20 72 6f 75 74 65 72 20 | 5b 69 6e 64 65 78 20 24 | router |[index $|
|000005b0| 61 72 67 76 20 31 5d 0a | 73 65 74 20 70 61 73 73 |argv 1].|set pass|
|000005c0| 77 6f 72 64 20 5b 69 6e | 64 65 78 20 24 61 72 67 |word [in|dex $arg|
|000005d0| 76 20 32 5d 0a 73 65 74 | 20 65 6e 61 62 6c 65 70 |v 2].set| enablep|
|000005e0| 61 73 73 20 5b 69 6e 64 | 65 78 20 24 61 72 67 76 |ass [ind|ex $argv|
|000005f0| 20 33 5d 0a 73 65 74 20 | 66 69 6c 65 6e 61 6d 65 | 3].set |filename|
|00000600| 20 5b 69 6e 64 65 78 20 | 24 61 72 67 76 20 34 5d | [index |$argv 4]|
|00000610| 0a 0a 70 72 6f 63 20 74 | 69 6d 65 64 6f 75 74 20 |..proc t|imedout |
|00000620| 7b 61 72 67 73 7d 20 7b | 0a 09 73 65 6e 64 5f 75 |{args} {|..send_u|
|00000630| 73 65 72 20 22 45 78 70 | 65 63 74 20 74 69 6d 65 |ser "Exp|ect time|
|00000640| 64 20 6f 75 74 22 20 24 | 61 72 67 73 20 5c 6e 0a |d out" $|args \n.|
|00000650| 09 65 78 69 74 0a 7d 0a | 0a 73 6f 75 72 63 65 20 |.exit.}.|.source |
|00000660| 63 69 73 63 6f 6c 6f 67 | 69 6e 2e 65 78 70 65 63 |ciscolog|in.expec|
|00000670| 74 0a 0a 69 66 20 7b 5b | 6c 65 6e 67 74 68 20 24 |t..if {[|length $|
|00000680| 61 72 67 76 5d 20 3c 20 | 35 7d 20 7b 0a 09 70 72 |argv] < |5} {..pr|
|00000690| 69 6e 74 20 22 49 6e 76 | 61 6c 69 64 20 6e 75 6d |int "Inv|alid num|
|000006a0| 62 65 72 20 6f 66 20 61 | 72 67 75 6d 65 6e 74 73 |ber of a|rguments|
|000006b0| 5c 6e 22 0a 09 65 78 69 | 74 0a 7d 0a 0a 73 65 6e |\n"..exi|t.}..sen|
|000006c0| 64 5f 75 73 65 72 20 5c | 6e 5c 6e 5c 6e 0a 73 70 |d_user \|n\n\n.sp|
|000006d0| 61 77 6e 20 74 65 6c 6e | 65 74 20 24 72 6f 75 74 |awn teln|et $rout|
|000006e0| 65 72 0a 6c 6f 67 69 6e | 20 24 65 6e 61 62 6c 65 |er.login| $enable|
|000006f0| 70 61 73 73 0a 73 65 6e | 64 20 63 6f 6e 66 69 67 |pass.sen|d config|
|00000700| 75 72 65 20 6e 65 74 77 | 6f 72 6b 5c 72 0a 0a 65 |ure netw|ork\r..e|
|00000710| 78 70 65 63 74 20 7b 2a | 63 6f 6e 66 69 67 75 72 |xpect {*|configur|
|00000720| 61 74 69 6f 6e 5c 20 66 | 69 6c 65 2a 5c 3f 5c 20 |ation\ f|ile*\?\ |
|00000730| 7d 20 7b 7d 20 5c 0a 09 | 74 69 6d 65 6f 75 74 09 |} {} \..|timeout.|
|00000740| 09 7b 74 69 6d 65 64 6f | 75 74 20 77 61 69 74 69 |.{timedo|ut waiti|
|00000750| 6e 67 20 66 6f 72 20 63 | 6f 6e 66 69 67 20 66 69 |ng for c|onfig fi|
|00000760| 6c 65 20 70 72 6f 6d 70 | 74 7d 0a 0a 73 65 6e 64 |le promp|t}..send|
|00000770| 20 6e 65 74 77 6f 72 6b | 5c 72 0a 65 78 70 65 63 | network|\r.expec|
|00000780| 74 20 7b 2a 49 50 5c 20 | 61 64 64 72 65 73 73 5c |t {*IP\ |address\|
|00000790| 20 6f 66 5c 20 72 65 6d | 6f 74 65 5c 20 68 6f 73 | of\ rem|ote\ hos|
|000007a0| 74 2a 5c 3f 5c 20 7d 20 | 7b 7d 20 5c 0a 09 74 69 |t*\?\ } |{} \..ti|
|000007b0| 6d 65 6f 75 74 09 09 7b | 74 69 6d 65 64 6f 75 74 |meout..{|timedout|
|000007c0| 20 77 61 69 74 69 6e 67 | 20 66 6f 72 20 72 65 6d | waiting| for rem|
|000007d0| 6f 74 65 20 68 6f 73 74 | 20 70 72 6f 6d 70 74 7d |ote host| prompt}|
|000007e0| 0a 0a 73 65 6e 64 20 24 | 6c 6f 63 61 6c 68 6f 73 |..send $|localhos|
|000007f0| 74 0a 0a 65 78 70 65 63 | 74 20 7b 2a 63 6f 6e 66 |t..expec|t {*conf|
|00000800| 69 67 75 72 61 74 69 6f | 6e 5c 20 66 69 6c 65 2a |iguratio|n\ file*|
|00000810| 3f 5c 20 7d 20 7b 7d 20 | 5c 0a 09 74 69 6d 65 6f |?\ } {} |\..timeo|
|00000820| 75 74 09 09 7b 74 69 6d | 65 64 6f 75 74 20 77 61 |ut..{tim|edout wa|
|00000830| 69 74 69 6e 67 20 66 6f | 72 20 66 69 6c 65 6e 61 |iting fo|r filena|
|00000840| 6d 65 20 70 72 6f 6d 70 | 74 7d 0a 0a 73 65 6e 64 |me promp|t}..send|
|00000850| 20 24 7b 66 69 6c 65 6e | 61 6d 65 7d 5c 72 0a 0a | ${filen|ame}\r..|
|00000860| 65 78 70 65 63 74 20 7b | 2a 43 6f 6e 66 69 67 75 |expect {|*Configu|
|00000870| 72 65 5c 20 75 73 69 6e | 67 2a 5c 5b 63 6f 6e 66 |re\ usin|g*\[conf|
|00000880| 69 72 6d 5c 5d 2a 7d 20 | 7b 7d 20 5c 0a 09 74 69 |irm\]*} |{} \..ti|
|00000890| 6d 65 6f 75 74 09 09 7b | 74 69 6d 65 64 6f 75 74 |meout..{|timedout|
|000008a0| 20 77 61 69 74 69 6e 67 | 20 66 6f 72 20 63 6f 6e | waiting| for con|
|000008b0| 66 69 72 6d 7d 0a 0a 73 | 65 6e 64 20 22 59 22 0a |firm}..s|end "Y".|
|000008c0| 0a 65 78 70 65 63 74 09 | 7b 2a 46 61 69 6c 65 64 |.expect.|{*Failed|
|000008d0| 2a 23 7d 09 7b 73 65 6e | 64 5f 75 73 65 72 20 54 |*#}.{sen|d_user T|
|000008e0| 46 54 50 20 67 65 74 20 | 66 61 69 6c 65 64 5c 6e |FTP get |failed\n|
|000008f0| 3b 20 65 78 69 74 20 31 | 7d 20 5c 0a 09 7b 2a 4f |; exit 1|} \..{*O|
|00000900| 4b 2a 23 7d 09 09 7b 73 | 65 6e 64 5f 75 73 65 72 |K*#}..{s|end_user|
|00000910| 20 54 46 54 50 20 67 65 | 74 20 73 75 63 63 65 65 | TFTP ge|t succee|
|00000920| 64 65 64 5c 6e 7d 0a 0a | 73 65 6e 64 20 22 77 72 |ded\n}..|send "wr|
|00000930| 69 74 65 5c 72 22 0a 65 | 78 70 65 63 74 20 7b 2a |ite\r".e|xpect {*|
|00000940| 5c 5b 4f 4b 5c 5d 2a 7d | 20 7b 7d 20 5c 0a 09 74 |\[OK\]*}| {} \..t|
|00000950| 69 6d 65 6f 75 74 20 20 | 7b 73 65 6e 64 5f 75 73 |imeout |{send_us|
|00000960| 65 72 20 57 72 69 74 65 | 20 66 61 69 6c 65 64 5c |er Write| failed\|
|00000970| 6e 3b 20 65 78 69 74 20 | 31 7d 0a 73 65 6e 64 20 |n; exit |1}.send |
|00000980| 51 55 49 54 5c 72 0a 65 | 78 70 65 63 74 20 2a 43 |QUIT\r.e|xpect *C|
|00000990| 6c 6f 73 65 64 2a 0a 65 | 78 69 74 20 30 0a 53 48 |losed*.e|xit 0.SH|
|000009a0| 41 52 5f 45 4f 46 0a 63 | 68 6d 6f 64 20 2b 78 20 |AR_EOF.c|hmod +x |
|000009b0| 27 63 69 73 63 6f 63 6f | 6e 66 69 67 75 72 65 27 |'ciscoco|nfigure'|
|000009c0| 0a 66 69 20 23 20 65 6e | 64 20 6f 66 20 6f 76 65 |.fi # en|d of ove|
|000009d0| 72 77 72 69 74 69 6e 67 | 20 63 68 65 63 6b 0a 69 |rwriting| check.i|
|000009e0| 66 20 74 65 73 74 20 2d | 66 20 27 63 69 73 63 6f |f test -|f 'cisco|
|000009f0| 67 65 74 27 0a 74 68 65 | 6e 0a 09 65 63 68 6f 20 |get'.the|n..echo |
|00000a00| 73 68 61 72 3a 20 77 69 | 6c 6c 20 6e 6f 74 20 6f |shar: wi|ll not o|
|00000a10| 76 65 72 2d 77 72 69 74 | 65 20 65 78 69 73 74 69 |ver-writ|e existi|
|00000a20| 6e 67 20 66 69 6c 65 20 | 22 27 63 69 73 63 6f 67 |ng file |"'ciscog|
|00000a30| 65 74 27 22 0a 65 6c 73 | 65 0a 63 61 74 20 3c 3c |et'".els|e.cat <<|
|00000a40| 20 5c 53 48 41 52 5f 45 | 4f 46 20 3e 20 27 63 69 | \SHAR_E|OF > 'ci|
|00000a50| 73 63 6f 67 65 74 27 0a | 23 21 2f 62 69 6e 2f 73 |scoget'.|#!/bin/s|
|00000a60| 68 0a 74 66 74 70 64 69 | 72 3d 2f 70 72 69 76 61 |h.tftpdi|r=/priva|
|00000a70| 74 65 2f 74 66 74 70 62 | 6f 6f 74 0a 65 78 70 6f |te/tftpb|oot.expo|
|00000a80| 72 74 20 74 66 74 70 64 | 69 72 0a 63 69 73 63 6f |rt tftpd|ir.cisco|
|00000a90| 67 65 74 2e 65 78 70 20 | 63 73 63 68 75 62 2d 67 |get.exp |cschub-g|
|00000aa0| 77 20 50 61 73 73 77 6f | 72 64 20 45 6e 61 62 6c |w Passwo|rd Enabl|
|00000ab0| 65 50 61 73 73 77 6f 72 | 64 20 63 73 63 68 75 62 |ePasswor|d cschub|
|00000ac0| 2d 67 77 0a 63 69 73 63 | 6f 67 65 74 2e 65 78 70 |-gw.cisc|oget.exp|
|00000ad0| 20 64 63 73 31 68 75 62 | 2d 67 77 20 50 61 73 73 | dcs1hub|-gw Pass|
|00000ae0| 77 6f 72 64 20 45 6e 61 | 62 6c 65 50 61 73 73 77 |word Ena|blePassw|
|00000af0| 6f 72 64 20 64 63 73 31 | 68 75 62 2d 67 77 0a 63 |ord dcs1|hub-gw.c|
|00000b00| 69 73 63 6f 67 65 74 2e | 65 78 70 20 64 63 73 32 |iscoget.|exp dcs2|
|00000b10| 68 75 62 2d 67 77 20 50 | 61 73 73 77 6f 72 64 20 |hub-gw P|assword |
|00000b20| 45 6e 61 62 6c 65 50 61 | 73 73 77 6f 72 64 20 64 |EnablePa|ssword d|
|00000b30| 63 73 32 68 75 62 2d 67 | 77 0a 63 69 73 63 6f 67 |cs2hub-g|w.ciscog|
|00000b40| 65 74 2e 65 78 70 20 73 | 64 6e 68 75 62 2d 67 77 |et.exp s|dnhub-gw|
|00000b50| 20 20 50 61 73 73 77 6f | 72 64 20 45 6e 61 62 6c | Passwo|rd Enabl|
|00000b60| 65 50 61 73 73 77 6f 72 | 64 20 73 64 6e 68 75 62 |ePasswor|d sdnhub|
|00000b70| 2d 67 77 0a 63 69 73 63 | 6f 67 65 74 2e 65 78 70 |-gw.cisc|oget.exp|
|00000b80| 20 6d 61 64 68 75 62 2d | 67 77 20 50 61 73 73 77 | madhub-|gw Passw|
|00000b90| 6f 72 64 20 45 6e 61 62 | 6c 65 50 61 73 73 77 6f |ord Enab|lePasswo|
|00000ba0| 72 64 20 6d 61 64 68 75 | 62 2d 67 77 0a 63 69 73 |rd madhu|b-gw.cis|
|00000bb0| 63 6f 67 65 74 2e 65 78 | 70 20 61 76 77 68 75 62 |coget.ex|p avwhub|
|00000bc0| 2d 67 77 20 50 61 73 73 | 77 6f 72 64 20 45 6e 61 |-gw Pass|word Ena|
|00000bd0| 62 6c 65 50 61 73 73 77 | 6f 72 64 20 61 76 77 68 |blePassw|ord avwh|
|00000be0| 75 62 2d 67 77 0a 63 69 | 73 63 6f 67 65 74 2e 65 |ub-gw.ci|scoget.e|
|00000bf0| 78 70 20 72 63 68 68 75 | 62 2d 67 77 20 50 61 73 |xp rchhu|b-gw Pas|
|00000c00| 73 77 6f 72 64 20 45 6e | 61 62 6c 65 50 61 73 73 |sword En|ablePass|
|00000c10| 77 6f 72 64 20 72 63 68 | 68 75 62 2d 67 77 0a 0a |word rch|hub-gw..|
|00000c20| 0a 53 48 41 52 5f 45 4f | 46 0a 63 68 6d 6f 64 20 |.SHAR_EO|F.chmod |
|00000c30| 2b 78 20 27 63 69 73 63 | 6f 67 65 74 27 0a 66 69 |+x 'cisc|oget'.fi|
|00000c40| 20 23 20 65 6e 64 20 6f | 66 20 6f 76 65 72 77 72 | # end o|f overwr|
|00000c50| 69 74 69 6e 67 20 63 68 | 65 63 6b 0a 69 66 20 74 |iting ch|eck.if t|
|00000c60| 65 73 74 20 2d 66 20 27 | 63 69 73 63 6f 67 65 74 |est -f '|ciscoget|
|00000c70| 2e 65 78 70 27 0a 74 68 | 65 6e 0a 09 65 63 68 6f |.exp'.th|en..echo|
|00000c80| 20 73 68 61 72 3a 20 77 | 69 6c 6c 20 6e 6f 74 20 | shar: w|ill not |
|00000c90| 6f 76 65 72 2d 77 72 69 | 74 65 20 65 78 69 73 74 |over-wri|te exist|
|00000ca0| 69 6e 67 20 66 69 6c 65 | 20 22 27 63 69 73 63 6f |ing file| "'cisco|
|00000cb0| 67 65 74 2e 65 78 70 27 | 22 0a 65 6c 73 65 0a 63 |get.exp'|".else.c|
|00000cc0| 61 74 20 3c 3c 20 5c 53 | 48 41 52 5f 45 4f 46 20 |at << \S|HAR_EOF |
|00000cd0| 3e 20 27 63 69 73 63 6f | 67 65 74 2e 65 78 70 27 |> 'cisco|get.exp'|
|00000ce0| 0a 23 21 2f 75 73 72 2f | 6c 6f 63 61 6c 2f 62 69 |.#!/usr/|local/bi|
|00000cf0| 6e 2f 65 78 70 65 63 74 | 20 2d 66 0a 23 0a 23 20 |n/expect| -f.#.# |
|00000d00| 46 65 74 63 68 20 63 6f | 6e 66 69 67 75 72 61 74 |Fetch co|nfigurat|
|00000d10| 69 6f 6e 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 20 |ion info|rmation |
|00000d20| 66 72 6f 6d 20 74 68 65 | 20 73 70 65 63 69 66 69 |from the| specifi|
|00000d30| 65 64 20 63 69 73 63 6f | 20 72 6f 75 74 65 72 0a |ed cisco| router.|
|00000d40| 23 0a 23 20 61 72 67 73 | 3a 20 63 69 73 63 6f 67 |#.# args|: ciscog|
|00000d50| 65 74 20 72 6f 75 74 65 | 72 20 70 61 73 73 77 64 |et route|r passwd|
|00000d60| 20 65 6e 61 62 6c 65 70 | 61 73 73 77 64 20 66 69 | enablep|asswd fi|
|00000d70| 6c 65 6e 61 6d 65 0a 23 | 0a 73 65 74 20 6c 6f 63 |lename.#|.set loc|
|00000d80| 61 6c 68 6f 73 74 20 5b | 65 78 65 63 20 68 6f 73 |alhost [|exec hos|
|00000d90| 74 6e 61 6d 65 5d 0a 73 | 65 74 20 74 66 74 70 64 |tname].s|et tftpd|
|00000da0| 69 72 20 2f 70 72 69 76 | 61 74 65 2f 74 66 74 70 |ir /priv|ate/tftp|
|00000db0| 62 6f 6f 74 0a 73 65 74 | 20 61 72 63 68 69 76 65 |boot.set| archive|
|00000dc0| 64 69 72 20 2f 6e 2f 6e | 65 74 6d 61 70 2f 48 55 |dir /n/n|etmap/HU|
|00000dd0| 42 53 2f 63 6f 6e 66 69 | 67 0a 0a 73 65 74 20 72 |BS/confi|g..set r|
|00000de0| 6f 75 74 65 72 20 5b 69 | 6e 64 65 78 20 24 61 72 |outer [i|ndex $ar|
|00000df0| 67 76 20 31 5d 0a 73 65 | 74 20 70 61 73 73 77 6f |gv 1].se|t passwo|
|00000e00| 72 64 20 5b 69 6e 64 65 | 78 20 24 61 72 67 76 20 |rd [inde|x $argv |
|00000e10| 32 5d 0a 73 65 74 20 65 | 6e 61 62 6c 65 70 61 73 |2].set e|nablepas|
|00000e20| 73 20 5b 69 6e 64 65 78 | 20 24 61 72 67 76 20 33 |s [index| $argv 3|
|00000e30| 5d 0a 73 65 74 20 66 69 | 6c 65 6e 61 6d 65 20 5b |].set fi|lename [|
|00000e40| 69 6e 64 65 78 20 24 61 | 72 67 76 20 34 5d 0a 0a |index $a|rgv 4]..|
|00000e50| 70 72 6f 63 20 74 69 6d | 65 64 6f 75 74 20 7b 61 |proc tim|edout {a|
|00000e60| 72 67 73 7d 20 7b 0a 09 | 73 65 6e 64 5f 75 73 65 |rgs} {..|send_use|
|00000e70| 72 20 22 45 78 70 65 63 | 74 20 74 69 6d 65 64 20 |r "Expec|t timed |
|00000e80| 6f 75 74 22 20 24 61 72 | 67 73 20 5c 6e 0a 09 65 |out" $ar|gs \n..e|
|00000e90| 78 69 74 0a 7d 0a 0a 73 | 6f 75 72 63 65 20 63 69 |xit.}..s|ource ci|
|00000ea0| 73 63 6f 6c 6f 67 69 6e | 2e 65 78 70 65 63 74 0a |scologin|.expect.|
|00000eb0| 0a 69 66 20 7b 5b 6c 65 | 6e 67 74 68 20 24 61 72 |.if {[le|ngth $ar|
|00000ec0| 67 76 5d 20 3c 20 35 7d | 20 7b 0a 09 70 72 69 6e |gv] < 5}| {..prin|
|00000ed0| 74 20 22 49 6e 76 61 6c | 69 64 20 6e 75 6d 62 65 |t "Inval|id numbe|
|00000ee0| 72 20 6f 66 20 61 72 67 | 75 6d 65 6e 74 73 5c 6e |r of arg|uments\n|
|00000ef0| 22 0a 09 65 78 69 74 0a | 7d 0a 0a 73 70 61 77 6e |"..exit.|}..spawn|
|00000f00| 20 74 65 6c 6e 65 74 20 | 24 72 6f 75 74 65 72 0a | telnet |$router.|
|00000f10| 6c 6f 67 69 6e 20 24 65 | 6e 61 62 6c 65 70 61 73 |login $e|nablepas|
|00000f20| 73 0a 73 65 6e 64 20 77 | 72 69 74 65 20 6e 65 74 |s.send w|rite net|
|00000f30| 77 6f 72 6b 5c 72 0a 0a | 65 78 70 65 63 74 20 7b |work\r..|expect {|
|00000f40| 2a 52 65 6d 6f 74 65 5c | 20 68 6f 73 74 2a 5c 3f |*Remote\| host*\?|
|00000f50| 5c 20 7d 20 7b 7d 20 5c | 0a 09 74 69 6d 65 6f 75 |\ } {} \|..timeou|
|00000f60| 74 09 09 7b 74 69 6d 65 | 64 6f 75 74 20 77 61 69 |t..{time|dout wai|
|00000f70| 74 69 6e 67 20 66 6f 72 | 20 52 65 6d 6f 74 65 20 |ting for| Remote |
|00000f80| 68 6f 73 74 20 70 72 6f | 6d 70 74 7d 0a 0a 73 65 |host pro|mpt}..se|
|00000f90| 6e 64 20 24 7b 6c 6f 63 | 61 6c 68 6f 73 74 7d 0a |nd ${loc|alhost}.|
|00000fa0| 0a 65 78 70 65 63 74 20 | 7b 2a 77 72 69 74 65 2a |.expect |{*write*|
|00000fb0| 3f 2a 7d 20 7b 7d 20 5c | 0a 09 74 69 6d 65 6f 75 |?*} {} \|..timeou|
|00000fc0| 74 09 09 7b 74 69 6d 65 | 64 6f 75 74 20 77 61 69 |t..{time|dout wai|
|00000fd0| 74 69 6e 67 20 66 6f 72 | 20 66 69 6c 65 6e 61 6d |ting for| filenam|
|00000fe0| 65 20 70 72 6f 6d 70 74 | 7d 0a 0a 69 66 20 7b 5b |e prompt|}..if {[|
|00000ff0| 66 69 6c 65 20 24 7b 74 | 66 74 70 64 69 72 7d 2f |file ${t|ftpdir}/|
|00001000| 24 7b 66 69 6c 65 6e 61 | 6d 65 7d 20 65 78 69 73 |${filena|me} exis|
|00001010| 74 73 5d 7d 20 7b 0a 09 | 69 66 20 7b 5b 66 69 6c |ts]} {..|if {[fil|
|00001020| 65 20 24 7b 74 66 74 70 | 64 69 72 7d 2f 24 7b 66 |e ${tftp|dir}/${f|
|00001030| 69 6c 65 6e 61 6d 65 7d | 2e 6f 6c 64 20 65 78 69 |ilename}|.old exi|
|00001040| 73 74 73 5d 7d 20 7b 0a | 09 09 69 66 20 7b 5b 66 |sts]} {.|..if {[f|
|00001050| 69 6c 65 20 24 7b 74 66 | 74 70 64 69 72 7d 2f 24 |ile ${tf|tpdir}/$|
|00001060| 7b 66 69 6c 65 6e 61 6d | 65 7d 2e 6f 6c 64 20 69 |{filenam|e}.old i|
|00001070| 73 66 69 6c 65 5d 20 3d | 3d 20 30 7d 20 7b 0a 09 |sfile] =|= 0} {..|
|00001080| 09 20 20 20 20 20 20 73 | 65 6e 64 5f 75 73 65 72 |. s|end_user|
|00001090| 20 22 24 7b 74 66 74 70 | 64 69 72 7d 2f 24 7b 66 | "${tftp|dir}/${f|
|000010a0| 69 6c 65 6e 61 6d 65 7d | 2e 6f 6c 64 3a 20 4e 6f |ilename}|.old: No|
|000010b0| 74 20 61 20 70 6c 61 69 | 6e 20 66 69 6c 65 5c 6e |t a plai|n file\n|
|000010c0| 22 0a 09 09 20 20 20 20 | 20 20 65 78 69 74 20 31 |"... | exit 1|
|000010d0| 0a 09 09 7d 0a 09 09 73 | 79 73 74 65 6d 20 72 6d |...}...s|ystem rm|
|000010e0| 20 2d 66 20 20 24 7b 74 | 66 74 70 64 69 72 7d 2f | -f ${t|ftpdir}/|
|000010f0| 24 7b 66 69 6c 65 6e 61 | 6d 65 7d 2e 6f 6c 64 0a |${filena|me}.old.|
|00001100| 09 7d 0a 09 73 79 73 74 | 65 6d 20 6d 76 20 2d 66 |.}..syst|em mv -f|
|00001110| 20 24 7b 74 66 74 70 64 | 69 72 7d 2f 24 7b 66 69 | ${tftpd|ir}/${fi|
|00001120| 6c 65 6e 61 6d 65 7d 20 | 24 7b 74 66 74 70 64 69 |lename} |${tftpdi|
|00001130| 72 7d 2f 24 7b 66 69 6c | 65 6e 61 6d 65 7d 2e 6f |r}/${fil|ename}.o|
|00001140| 6c 64 0a 7d 0a 73 79 73 | 74 65 6d 20 74 6f 75 63 |ld.}.sys|tem touc|
|00001150| 68 20 24 7b 74 66 74 70 | 64 69 72 7d 2f 24 7b 66 |h ${tftp|dir}/${f|
|00001160| 69 6c 65 6e 61 6d 65 7d | 0a 73 79 73 74 65 6d 20 |ilename}|.system |
|00001170| 63 68 6d 6f 64 20 36 36 | 36 20 24 7b 74 66 74 70 |chmod 66|6 ${tftp|
|00001180| 64 69 72 7d 2f 24 7b 66 | 69 6c 65 6e 61 6d 65 7d |dir}/${f|ilename}|
|00001190| 0a 0a 0a 73 65 6e 64 20 | 24 7b 66 69 6c 65 6e 61 |...send |${filena|
|000011a0| 6d 65 7d 5c 72 0a 65 78 | 70 65 63 74 20 7b 2a 57 |me}\r.ex|pect {*W|
|000011b0| 72 69 74 65 5c 20 66 69 | 6c 65 2a 5c 5b 63 6f 6e |rite\ fi|le*\[con|
|000011c0| 66 69 72 6d 5c 5d 2a 7d | 20 7b 7d 20 5c 0a 09 74 |firm\]*}| {} \..t|
|000011d0| 69 6d 65 6f 75 74 09 09 | 7b 74 69 6d 65 64 20 6f |imeout..|{timed o|
|000011e0| 75 74 20 77 61 69 74 69 | 6e 67 20 66 6f 72 20 63 |ut waiti|ng for c|
|000011f0| 6f 6e 66 69 72 6d 7d 0a | 0a 73 65 6e 64 20 22 59 |onfirm}.|.send "Y|
|00001200| 22 0a 65 78 70 65 63 74 | 09 7b 2a 46 61 69 6c 65 |".expect|.{*Faile|
|00001210| 64 2a 23 7d 09 7b 73 65 | 74 20 66 61 69 6c 65 64 |d*#}.{se|t failed|
|00001220| 20 31 3b 20 73 65 6e 64 | 5f 75 73 65 72 20 5c 6e | 1; send|_user \n|
|00001230| 54 46 54 50 20 57 72 69 | 74 65 20 66 61 69 6c 65 |TFTP Wri|te faile|
|00001240| 64 5c 6e 7d 20 5c 0a 09 | 7b 2a 4f 4b 2a 23 7d 09 |d\n} \..|{*OK*#}.|
|00001250| 09 7b 73 65 74 20 66 61 | 69 6c 65 64 20 30 3b 20 |.{set fa|iled 0; |
|00001260| 73 65 6e 64 5f 75 73 65 | 72 20 5c 6e 54 46 54 50 |send_use|r \nTFTP|
|00001270| 20 57 72 69 74 65 20 73 | 75 63 63 65 65 64 65 64 | Write s|ucceeded|
|00001280| 5c 6e 7d 0a 0a 73 65 6e | 64 20 51 55 49 54 5c 72 |\n}..sen|d QUIT\r|
|00001290| 0a 69 66 20 7b 24 66 61 | 69 6c 65 64 20 3d 3d 20 |.if {$fa|iled == |
|000012a0| 30 7d 20 7b 0a 09 73 79 | 73 74 65 6d 20 63 70 20 |0} {..sy|stem cp |
|000012b0| 24 7b 74 66 74 70 64 69 | 72 7d 2f 24 7b 66 69 6c |${tftpdi|r}/${fil|
|000012c0| 65 6e 61 6d 65 7d 20 24 | 7b 61 72 63 68 69 76 65 |ename} $|{archive|
|000012d0| 64 69 72 7d 2f 24 7b 66 | 69 6c 65 6e 61 6d 65 7d |dir}/${f|ilename}|
|000012e0| 0a 09 73 65 6e 64 5f 75 | 73 65 72 20 20 22 53 61 |..send_u|ser "Sa|
|000012f0| 76 65 64 20 63 6f 6e 66 | 69 67 75 72 61 74 69 6f |ved conf|iguratio|
|00001300| 6e 2e 2e 20 22 0a 7d 0a | 73 79 73 74 65 6d 20 63 |n.. ".}.|system c|
|00001310| 6c 65 61 6e 63 6f 6e 66 | 69 67 20 24 7b 74 66 74 |leanconf|ig ${tft|
|00001320| 70 64 69 72 7d 2f 24 7b | 66 69 6c 65 6e 61 6d 65 |pdir}/${|filename|
|00001330| 7d 0a 73 65 6e 64 5f 75 | 73 65 72 20 22 20 20 63 |}.send_u|ser " c|
|00001340| 6c 65 61 6e 65 64 20 63 | 6f 6e 66 69 67 75 72 61 |leaned c|onfigura|
|00001350| 74 69 6f 6e 5c 6e 22 0a | 65 78 69 74 20 0a 53 48 |tion\n".|exit .SH|
|00001360| 41 52 5f 45 4f 46 0a 63 | 68 6d 6f 64 20 2b 78 20 |AR_EOF.c|hmod +x |
|00001370| 27 63 69 73 63 6f 67 65 | 74 2e 65 78 70 27 0a 66 |'ciscoge|t.exp'.f|
|00001380| 69 20 23 20 65 6e 64 20 | 6f 66 20 6f 76 65 72 77 |i # end |of overw|
|00001390| 72 69 74 69 6e 67 20 63 | 68 65 63 6b 0a 69 66 20 |riting c|heck.if |
|000013a0| 74 65 73 74 20 2d 66 20 | 27 63 69 73 63 6f 6c 6f |test -f |'ciscolo|
|000013b0| 67 69 6e 2e 65 78 70 65 | 63 74 27 0a 74 68 65 6e |gin.expe|ct'.then|
|000013c0| 0a 09 65 63 68 6f 20 73 | 68 61 72 3a 20 77 69 6c |..echo s|har: wil|
|000013d0| 6c 20 6e 6f 74 20 6f 76 | 65 72 2d 77 72 69 74 65 |l not ov|er-write|
|000013e0| 20 65 78 69 73 74 69 6e | 67 20 66 69 6c 65 20 22 | existin|g file "|
|000013f0| 27 63 69 73 63 6f 6c 6f | 67 69 6e 2e 65 78 70 65 |'ciscolo|gin.expe|
|00001400| 63 74 27 22 0a 65 6c 73 | 65 0a 63 61 74 20 3c 3c |ct'".els|e.cat <<|
|00001410| 20 5c 53 48 41 52 5f 45 | 4f 46 20 3e 20 27 63 69 | \SHAR_E|OF > 'ci|
|00001420| 73 63 6f 6c 6f 67 69 6e | 2e 65 78 70 65 63 74 27 |scologin|.expect'|
|00001430| 0a 0a 70 72 6f 63 20 6c | 6f 67 69 6e 20 7b 61 72 |..proc l|ogin {ar|
|00001440| 67 73 7d 20 7b 0a 09 67 | 6c 6f 62 61 6c 20 70 61 |gs} {..g|lobal pa|
|00001450| 73 73 77 6f 72 64 0a 09 | 67 6c 6f 62 61 6c 20 65 |ssword..|global e|
|00001460| 6e 61 62 6c 65 70 61 73 | 73 0a 0a 09 65 78 70 65 |nablepas|s...expe|
|00001470| 63 74 09 7b 2a 50 61 73 | 73 77 6f 72 64 3a 2a 7d |ct.{*Pas|sword:*}|
|00001480| 20 7b 7d 20 5c 0a 09 09 | 74 69 6d 65 6f 75 74 20 | {} \...|timeout |
|00001490| 7b 74 69 6d 65 64 6f 75 | 74 20 77 61 69 74 69 6e |{timedou|t waitin|
|000014a0| 67 20 66 6f 72 20 70 61 | 73 73 77 6f 72 64 20 70 |g for pa|ssword p|
|000014b0| 72 6f 6d 70 74 7d 0a 09 | 23 20 75 67 6c 79 21 0a |rompt}..|# ugly!.|
|000014c0| 09 73 79 73 74 65 6d 20 | 73 6c 65 65 70 20 31 0a |.system |sleep 1.|
|000014d0| 09 73 65 6e 64 20 24 7b | 70 61 73 73 77 6f 72 64 |.send ${|password|
|000014e0| 7d 5c 72 0a 09 65 78 70 | 65 63 74 20 7b 2a 50 61 |}\r..exp|ect {*Pa|
|000014f0| 73 73 77 6f 72 64 3a 2a | 7d 09 7b 73 65 6e 64 5f |ssword:*|}.{send_|
|00001500| 75 73 65 72 20 42 61 64 | 20 70 61 73 73 77 6f 72 |user Bad| passwor|
|00001510| 64 5c 6e 3b 20 65 78 69 | 74 7d 20 5c 0a 09 09 7b |d\n; exi|t} \...{|
|00001520| 2a 3e 7d 09 09 7b 7d 20 | 5c 0a 09 09 74 69 6d 65 |*>}..{} |\...time|
|00001530| 6f 75 74 09 09 7b 74 69 | 6d 65 64 6f 75 74 20 77 |out..{ti|medout w|
|00001540| 61 69 74 69 6e 67 20 66 | 6f 72 20 6c 6f 67 69 6e |aiting f|or login|
|00001550| 20 70 72 6f 6d 70 74 7d | 0a 0a 09 69 66 20 7b 5b | prompt}|...if {[|
|00001560| 6c 65 6e 67 74 68 20 24 | 61 72 67 73 5d 7d 20 7b |length $|args]} {|
|00001570| 0a 09 09 73 65 6e 64 20 | 65 6e 61 62 6c 65 5c 72 |...send |enable\r|
|00001580| 0a 09 09 65 78 70 65 63 | 74 20 7b 2a 50 61 73 73 |...expec|t {*Pass|
|00001590| 77 6f 72 64 3a 2a 7d 09 | 7b 7d 20 5c 0a 09 09 09 |word:*}.|{} \....|
|000015a0| 74 69 6d 65 6f 75 74 09 | 7b 74 69 6d 65 64 6f 75 |timeout.|{timedou|
|000015b0| 74 20 77 61 69 74 69 6e | 67 20 66 6f 72 20 65 6e |t waitin|g for en|
|000015c0| 61 62 6c 65 20 70 61 73 | 73 77 6f 72 64 20 70 72 |able pas|sword pr|
|000015d0| 6f 6d 70 74 3b 20 65 78 | 69 74 7d 0a 09 09 23 20 |ompt; ex|it}...# |
|000015e0| 75 67 6c 79 21 0a 09 09 | 73 79 73 74 65 6d 20 73 |ugly!...|system s|
|000015f0| 6c 65 65 70 20 31 0a 09 | 09 73 65 6e 64 20 5b 69 |leep 1..|.send [i|
|00001600| 6e 64 65 78 20 24 61 72 | 67 73 20 30 5d 5c 72 0a |ndex $ar|gs 0]\r.|
|00001610| 09 09 65 78 70 65 63 74 | 20 7b 2a 23 7d 09 7b 7d |..expect| {*#}.{}|
|00001620| 20 5c 0a 09 09 20 20 20 | 7b 2a 50 61 73 73 77 6f | \... |{*Passwo|
|00001630| 72 64 3a 2a 7d 20 7b 73 | 65 6e 64 5f 75 73 65 72 |rd:*} {s|end_user|
|00001640| 20 57 72 6f 6e 67 20 65 | 6e 61 62 6c 65 20 70 61 | Wrong e|nable pa|
|00001650| 73 73 77 6f 72 64 5c 6e | 3b 20 65 78 69 74 7d 20 |ssword\n|; exit} |
|00001660| 5c 0a 09 09 20 20 20 74 | 69 6d 65 6f 75 74 09 7b |\... t|imeout.{|
|00001670| 74 69 6d 65 64 6f 75 74 | 20 77 61 69 74 69 6e 67 |timedout| waiting|
|00001680| 20 66 6f 72 20 65 6e 61 | 62 6c 65 64 20 70 72 6f | for ena|bled pro|
|00001690| 6d 70 74 3b 20 65 78 69 | 74 7d 0a 09 7d 0a 7d 0a |mpt; exi|t}..}.}.|
|000016a0| 09 0a 53 48 41 52 5f 45 | 4f 46 0a 66 69 20 23 20 |..SHAR_E|OF.fi # |
|000016b0| 65 6e 64 20 6f 66 20 6f | 76 65 72 77 72 69 74 69 |end of o|verwriti|
|000016c0| 6e 67 20 63 68 65 63 6b | 0a 69 66 20 74 65 73 74 |ng check|.if test|
|000016d0| 20 2d 66 20 27 63 6c 65 | 61 6e 63 6f 6e 66 69 67 | -f 'cle|anconfig|
|000016e0| 27 0a 74 68 65 6e 0a 09 | 65 63 68 6f 20 73 68 61 |'.then..|echo sha|
|000016f0| 72 3a 20 77 69 6c 6c 20 | 6e 6f 74 20 6f 76 65 72 |r: will |not over|
|00001700| 2d 77 72 69 74 65 20 65 | 78 69 73 74 69 6e 67 20 |-write e|xisting |
|00001710| 66 69 6c 65 20 22 27 63 | 6c 65 61 6e 63 6f 6e 66 |file "'c|leanconf|
|00001720| 69 67 27 22 0a 65 6c 73 | 65 0a 63 61 74 20 3c 3c |ig'".els|e.cat <<|
|00001730| 20 5c 53 48 41 52 5f 45 | 4f 46 20 3e 20 27 63 6c | \SHAR_E|OF > 'cl|
|00001740| 65 61 6e 63 6f 6e 66 69 | 67 27 0a 23 21 2f 75 73 |eanconfi|g'.#!/us|
|00001750| 72 2f 62 69 6e 2f 70 65 | 72 6c 0a 0a 24 66 69 6c |r/bin/pe|rl..$fil|
|00001760| 65 20 3d 20 24 41 52 47 | 56 5b 30 5d 3b 0a 24 6e |e = $ARG|V[0];.$n|
|00001770| 65 77 66 69 6c 65 20 3d | 20 24 66 69 6c 65 20 2e |ewfile =| $file .|
|00001780| 20 22 2e 6e 65 77 22 3b | 0a 64 69 65 20 22 4e 6f | ".new";|.die "No|
|00001790| 20 66 69 6c 65 20 73 70 | 65 63 69 66 69 65 64 5c | file sp|ecified\|
|000017a0| 6e 22 20 75 6e 6c 65 73 | 73 20 24 66 69 6c 65 3b |n" unles|s $file;|
|000017b0| 0a 0a 6f 70 65 6e 28 43 | 46 47 2c 20 22 3c 24 66 |..open(C|FG, "<$f|
|000017c0| 69 6c 65 22 29 20 7c 7c | 20 64 69 65 20 22 43 61 |ile") ||| die "Ca|
|000017d0| 6e 27 74 20 6f 70 65 6e | 20 24 66 69 6c 65 5c 6e |n't open| $file\n|
|000017e0| 22 3b 0a 6f 70 65 6e 28 | 4e 45 57 43 46 47 2c 20 |";.open(|NEWCFG, |
|000017f0| 22 3e 24 6e 65 77 66 69 | 6c 65 22 29 20 7c 7c 20 |">$newfi|le") || |
|00001800| 64 69 65 20 22 43 61 6e | 27 74 20 6f 70 65 6e 20 |die "Can|'t open |
|00001810| 24 6e 65 77 66 69 6c 65 | 5c 6e 22 3b 0a 0a 70 72 |$newfile|\n";..pr|
|00001820| 69 6e 74 20 4e 45 57 43 | 46 47 20 3c 3c 22 45 4f |int NEWC|FG <<"EO|
|00001830| 4d 22 3b 0a 21 0a 21 20 | 4e 6f 74 65 3a 20 74 68 |M";.!.! |Note: th|
|00001840| 69 73 20 66 69 6c 65 20 | 28 24 66 69 6c 65 29 20 |is file |($file) |
|00001850| 68 61 73 20 68 61 64 20 | 74 68 65 20 70 61 73 73 |has had |the pass|
|00001860| 77 6f 72 64 73 20 72 65 | 6d 6f 76 65 64 20 66 6f |words re|moved fo|
|00001870| 72 0a 21 20 20 20 20 20 | 20 20 73 65 63 75 72 69 |r.! | securi|
|00001880| 74 79 20 72 65 61 73 6f | 6e 73 2e 0a 21 0a 45 4f |ty reaso|ns..!.EO|
|00001890| 4d 0a 77 68 69 6c 65 20 | 28 3c 43 46 47 3e 29 20 |M.while |(<CFG>) |
|000018a0| 7b 0a 09 69 66 20 28 2f | 5e 28 65 6e 61 62 6c 65 |{..if (/|^(enable|
|000018b0| 2d 70 61 73 73 77 6f 72 | 64 7c 70 61 73 73 77 6f |-passwor|d|passwo|
|000018c0| 72 64 29 5c 73 2b 2f 29 | 20 7b 0a 09 09 70 72 69 |rd)\s+/)| {...pri|
|000018d0| 6e 74 20 4e 45 57 43 46 | 47 20 22 21 20 24 31 20 |nt NEWCF|G "! $1 |
|000018e0| 43 45 4e 53 4f 52 45 44 | 5c 6e 22 3b 0a 09 09 6e |CENSORED|\n";...n|
|000018f0| 65 78 74 3b 0a 09 7d 0a | 09 70 72 69 6e 74 20 4e |ext;..}.|.print N|
|00001900| 45 57 43 46 47 3b 0a 7d | 0a 63 6c 6f 73 65 28 43 |EWCFG;.}|.close(C|
|00001910| 46 47 29 3b 0a 63 6c 6f | 73 65 28 4e 45 57 43 46 |FG);.clo|se(NEWCF|
|00001920| 47 29 3b 0a 0a 72 65 6e | 61 6d 65 28 24 6e 65 77 |G);..ren|ame($new|
|00001930| 66 69 6c 65 2c 20 24 66 | 69 6c 65 29 20 7c 7c 20 |file, $f|ile) || |
|00001940| 64 69 65 20 22 43 61 6e | 27 74 20 72 65 6e 61 6d |die "Can|'t renam|
|00001950| 65 20 24 6e 65 77 66 69 | 6c 65 20 74 6f 20 24 66 |e $newfi|le to $f|
|00001960| 69 6c 65 3a 20 24 21 5c | 6e 22 3b 0a 0a 53 48 41 |ile: $!\|n";..SHA|
|00001970| 52 5f 45 4f 46 0a 63 68 | 6d 6f 64 20 2b 78 20 27 |R_EOF.ch|mod +x '|
|00001980| 63 6c 65 61 6e 63 6f 6e | 66 69 67 27 0a 66 69 20 |cleancon|fig'.fi |
|00001990| 23 20 65 6e 64 20 6f 66 | 20 6f 76 65 72 77 72 69 |# end of| overwri|
|000019a0| 74 69 6e 67 20 63 68 65 | 63 6b 0a 23 09 45 6e 64 |ting che|ck.#.End|
|000019b0| 20 6f 66 20 73 68 65 6c | 6c 20 61 72 63 68 69 76 | of shel|l archiv|
|000019c0| 65 0a 65 78 69 74 20 30 | 0a |e.exit 0|. |
+--------+-------------------------+-------------------------+--------+--------+